package com.wisdomech.server.service;


import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.Spider;

/**
 * @Author: tubashu
 * @Date: 2018/8/9 20:31
 * @email: tubashu@mail.ru
 */
@Component
public class MyApplicationRunner implements ApplicationRunner {


    @Override
    public void run(ApplicationArguments var1) throws Exception {
        String addr = "https://www.weixinqun.com/personal?id=966875";//学生类
        //String addr1 = "http://www.wisdomech.com";//学生类
        Spider.create(new CardProcessor())
                //从"https://github.com/code4craft"开始抓
                .addUrl(addr)
                .addPipeline(new CardPipeline())
                //开启5个线程抓取
                .thread(2)
                //启动爬虫
                .run();


    }
}
